<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../../css/iuapmobile.um.css">
		<link rel="stylesheet" href="../../css/font-icons.css">
		<link rel="stylesheet" type="text/css" href="../../css/iuapmobile.um.listview.css">

		<style>
			.msg-info {
				position: relative;
			}
			.msg-info .um-badge {
				position: absolute;
				right: -10px;
				font-size: 12px;
			}
			.msg-header {
				width: 40px;
				height: 40px;
				line-height: 40px;
				background: blue;
				border-radius: 50%;
				text-align: center;
				color: white;
			}

		</style>

		<script src="../../js/summer.js" ></script>
		<script src="../../js/jquery.min.js" ></script>
		<script src="../../js/Frameworks/iuapmobile.frameworks.ui.js" ></script>
		<script type="text/javascript" src="../../js/knockout.js"></script>

		<script type="text/javascript" src="../../js/Frameworks/iuapmobile.frameworks.listview.js"></script>
	</head>
	<body class="f14">
		<div class="um-win" id="install">
			<div class="um-header" >
				<h3>安装派工列表</h3>
				<a href="#" class="um-back back" >返回</a>
			</div>

			<div class="um-content">
				<div class="um-listview-wrap" id="listview">
					<div class="hd1 pt15 pb15 f15" style="text-align: center;">
						<span class="ti-reload hd1">没有找到数据 点击刷新</span>
					</div>
					<ul class="um-list um-no-active" data-bind="foreach: data">
						<li class="um-listview-row" >
							<a href="#" class="um-list-item um-swipe-action um-no-icon">
							<div class="um-list-item-inner">
								<div class="um-list-item-body um-text-overflow f14" style="padding-right:5px;">
									<div class="um-bgc-blue um-white pt5 pb5 ">
										︱派工单单号:<span data-bind="text:vbillcode"></span>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt10 mb10">
											派工时间:<span data-bind="text:pgsj1"></span>
										</div>
										<div class="um-md-6 w_50 fl mt10 mb10">
											要求竣工日期:<span data-bind="text:yqjgrq1"></span>
										</div>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt10 mb10">
											<p>
												<!-- <span class="um-red" data-bind="attr: {id: vbillcode}" style="display: none">*</span> -->
												<span>加急类型:</span><span data-bind="text:jjlx1=='N'?'否':'是'"></span>
											</p>
										</div>
										<div class="um-md-6 w_50 fl mt10 mb10">
											工程主管:<span data-bind="text:gczg1"></span>
										</div>
									</div>
									<div class="w">
										<div class="um-md-6 w_50 fl mt10 mb10">
											派工数量:<span data-bind="text:pg_num"></span>
										</div>
									</div>
								</div>
							</div> </a>
						</li>
					</ul>
				</div>

			</div>

			<div class="um-footer">

			</div>
		</div>
		<script>
			var updateList;
			$(function() {
				var installListindex = 1;
				var installList = [];
				var times = 1;
				var ViewModel = function() {
				};
				var viewModel = new ViewModel();
				//构造控件实例
				var listview = UM.listview("#listview");
				//当前第几页
				viewModel.data = ko.observableArray([]);
				ko.applyBindings(viewModel);
				//绑定叶号，是否第一次bool
				updateList = function(index, cout) {
					doPost(adressHead.ISjtzImpl, "getAzPgxxList_v2", {
						dataParm : {
							empId :summer.getStorage("userinfo").empId,
							star : index,
							status : 1,
							count : cout
						}
					}, function(data) {
						if (index == 1) {
							try {
								while (viewModel.data.shift()) {
								}
							} catch(e) {
							}
						};
						if (data.result == 1) {
							if (data.data.length != "") {
								$(".hd1").css("display", "none");
								//hide
								for (var i = 0; i < data.data.length; i++) {
									var msgtype = parseInt(data.data[i].type) - 1;
									viewModel.data.push({
										'billid' : data.data[i].billid,
										'vbillcode' : data.data[i].vbillcode,
										//'pgrq1' : newArr[i].dispatchDate.substr(0, 10),
										'pgsj1' : data.data[i].dispatchTime.substr(11, 18),
										'yqjgrq1' : data.data[i].requiredCompletionDate.substr(0, 10),
										'jjlx1' : data.data[i].expressType,
										'gczg1' : data.data[i].engineeringSupervisor,
										//'' : newArr[i].pg_num,
										'pg_num' : data.data[i].pg_num,
										'cs' : data.data[i].cs,
										'sgdw' : data.data[i].sgdw
									});
								};
								//for (var i = 0; i < data.data.length; i++) {
								//	if (data.data[i].expressType == "Y") {
								//		$("#" + data.data[i].vbillcode).css("display", "block");
								//	}
								//}
								installListindex += data.data.length;
							} else {
								if (times != 1) {
									UM.toast({
										title : '友情提示：',
										text : '没有更多单据',
										duration : 1000
									});
								}
								$(".hd1").css("display", "block");
								//show
								times++;
							}
						} else {
							UM.toast({
								title : '友情提示：',
								text : data.msg,
								duration : 1000
							});
						}
						listview.refresh();
					}, function(err) {
						console.log(err);
					});
				};
				
				window.bind = function() {
					updateList(1, 4);
				};
				$(".hd1").click(function(e) {
					updateList(1, 4);
					e.stopPropagation(); 
				});
				//添加控件方法
				listview.on("pullDown", function(sender) {
					installListindex = 1;
					updateList(installListindex, 4);
					//viewModel.data.unshift(row);
					sender.refresh();
				});
				listview.on("pullUp", function(sender) {
					updateList(installListindex, 4);
					sender.refresh();
				});
				listview.on("itemClick", function(sender, args) {
					setTimeout(function() {
						summer.openWin({
							id : "installed",
							url : "html/install/installed.html",
							pageParam : {
								billid : viewModel.data()[args.rowIndex].billid,
								cs : viewModel.data()[args.rowIndex].cs,
								sgdw : viewModel.data()[args.rowIndex].sgdw,
							}
						});
					}, 100);
					//toasts(args.rowIndex);
					//这里可以处理行点击事件，参数sender即为当前列表实例对象，args对象有2个属性，即rowIndex(行索引)和$target(目标行的jquery对象)
					//toasts("您点击了列表的第" + (args.rowIndex + 1) +　"行！");
				});
			});
			function rebind() {
				window.bind();
			}

			summerready = function() {
				updateList(1, 4);
			}
		</script>
	</body>
</html>
<script type="text/javascript" src="../../js/Myjs/Common.js"></script>